#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@File    : mngs_get_qrcode.py
@Author  : Bing Liang
@Email   : believer19940901@gmail.com
@Date    : 2025/11/13 16:49
@Description : 生成静态资源url的二维码图片
"""
from argparse import ArgumentParser, Namespace
from pathlib import Path
import qrcode


def mngs_get_qrcode(args: Namespace):
    url = args.url.strip()
    out_png = Path(args.out_png).absolute()
    out_png.parent.mkdir(parents=True, exist_ok=True)
    image = qrcode.make(url)
    image.save(out_png)


if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument("--url", type=str, required=True, default=None)
    parser.add_argument("--out_png", type=str, required=True, default=None)
    arguments = parser.parse_args()
    mngs_get_qrcode(arguments)